using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
using NetduinoHappyHour.Util;

namespace NetduinoHappyHour.Hardware
{
    class SensorFactory
    {
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static ISensor Instance()
        {
            return new JohnWilson.HC_SR04(Pins.GPIO_PIN_D2, Pins.GPIO_PIN_D3);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="Type"></param>
        /// <param name="PinToRead"></param>
        /// <returns></returns>
        public static ISensor Instance(String ClassName, Cpu.Pin PinToRead)
        {
            ISensor sensor;
            ObjectFactory retriever = new ObjectFactory();
            sensor = (ISensor)retriever.CreateObjectByNameAndParam(ClassName);
            sensor.Init(PinToRead);
            return sensor;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="Type"></param>
        /// <param name="PinToRead"></param>
        /// <param name="PinToTrigger"></param>
        /// <returns></returns>
        public static ISensor Instance(String ClassName, Cpu.Pin PinToRead, Cpu.Pin PinToTrigger)
        {
            ISensor sensor;
            ObjectFactory retriever = new ObjectFactory();
            sensor = (ISensor)retriever.CreateObjectByNameAndParam(ClassName);
            sensor.Init(PinToRead, PinToTrigger);
            return sensor;
        }
    }
}
